package controllers;

import beans.LocalizedBean;
import connectivity.Dbmanager;
import connectivity.QueryManager;
import java.io.*;
import java.net.*;
import javax.servlet.*;
import javax.servlet.http.*;
import models.DigitalClassSession;

public class DigitalClassMediaController extends HttpServlet {
    private Dbmanager dbManager;
    private QueryManager queryManager;
    
    /*
     * HTTP GET Request
     */
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        String address = "/digital_class_media.jsp";
        dbManager = new Dbmanager();
        dbManager.openConnection();
        queryManager = new QueryManager(dbManager);        
        DigitalClassSession session = queryManager.getDigitalClassSession(Integer.parseInt(request.getParameter("ID")));
        
        dbManager.closeConnection();
        
        request.setAttribute("digitalClassSession", session);
        RequestDispatcher dispatcher = request.getRequestDispatcher(address);
        dispatcher.forward(request, response);
    }
}